<template>
    <div class="forum-item">
        <div class="item" @click="toLinkFun">
            <div class="item-top">
                <div class="item-top-title u-line-1">
                    {{ item.content }}
                </div>
            </div>
            <div class="item-content">
                <div class="item-content-right">
                    <div class="item-content-desc u-line-1">
                        原帖：{{ item.f_title }}
                    </div>
                    <div class="item-content-footer">
                        <div class="item-content-action">
                            <div class="item-content-footer-left">
                                <span>{{ item.type_title }} · </span>
                                <span style="color: #9fa6c2">{{ item.created_at }}</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>
</template>

<script>
export default {
    name: "ForumItem",
    props: {
        item: {
            type: Object,
            default: () => {
                return {}
            }
        },
        showComment:{
            type:Boolean,
            default:false
        },
        showZan:{
            type:Boolean,
            default:false
        },
        showCommentNum:{
            type:Boolean,
            default:false
        },
        showUser:{
            type:Boolean,
            default:false
        }
    },
    methods:{
        commentFun(){
            this.$emit('comment')
        },
        zanFun(){
            this.$emit('zan')
        },
        toLinkFun(){
            this.$router.push({
                path:`/forum-detail/${this.item.f_id}`
            })
        }
    }
};
</script>

<style lang="less" scoped>
.forum-item {
    width: 100%;

    .item {
        width: 100%;
        background: rgba(#64aefb, 0.1);
        border-radius: 0.0625rem;
        margin-bottom: 0.375rem;
        padding-bottom: 0.025rem;
        cursor: pointer;

        .item-top {
            display: flex;
            align-items: center;
            padding: 0 0.475rem;
            height: 0.8rem;
            box-sizing: border-box;

            .item-tip {
                width: 0.6rem;
                height: 0.3rem;
                text-align: center;
                line-height: 0.3rem;
                background: #f18c3c;
                border-radius: 0.025rem;
                font-size: 0.15rem;
                color: #ffffd2;
                margin-right: 0.25rem;
            }

            .item-top-title {
                font-size: 0.25rem;
                color: #000;
                font-weight: bold;
                width: 12rem;
            }

            .item-user {
                display: flex;
                align-items: center;
                flex: 1;
                justify-content: flex-end;

                .item-user-logo {
                    width: 0.55rem;
                    height: 0.55rem;
                    margin-right: 0.2rem;

                    img {
                        width: 100%;
                        height: 100%;
                        border-radius: 50%;
                    }
                }

                .item-user-name {
                    font-size: 0.2rem;
                    color: #4f8af8;
                    font-weight: bold;
                }

                .item-user-desc {
                    font-size: 0.125rem;
                    color: #666;
                    padding-top: 0.05rem;
                }
            }
        }

        .item-content {
            display: flex;
            box-sizing: border-box;
            padding: 0.45rem;
            margin: 0 0.025rem;
            background: #fff;

            .item-content-img {
                display: flex;
                justify-content: center;
                align-items: center;
                width: 3.2875rem;
                height: 1.8875rem;
                margin-right: 0.4375rem;

                img {
                    width: 100%;
                    height: 100%;
                    object-fit: cover;
                }
            }

            .item-content-right {
                position: relative;
                height: 0.8875rem;
                flex: 1;
            }

            .item-content-footer {
                position: absolute;
                left: 0;
                bottom: 0;
                width: 100%;

                .item-content-action {
                    display: flex;
                    align-items: center;
                    justify-content: space-between;
                }

                .item-content-comment {
                    display: flex;
                    align-items: center;
                    padding-top: 0.1625rem;
                    font-size: 0.2rem;
                    color: #333;

                    .item-content-comment--tip {
                        text-align: center;
                        line-height: 0.3rem;
                        width: 0.9rem;
                        height: 0.3rem;
                        background: #F18C3C;
                        border-radius: 0.025rem;
                        font-size: 0.15rem;
                        color: #FFFFD2;
                        margin-right: 0.1875rem;
                    }
                }

                .item-content-footer-left {
                    font-size: 0.2rem;
                    color: #000;
                }

                .item-content-footer-right {
                    display: flex;
                    align-items: center;

                    .item-content-icon {
                        display: flex;
                        justify-content: center;
                        align-items: center;
                        font-size: 0.2rem;
                        color: #000;
                        margin-left: 0.4rem;
                        cursor: pointer;
                        user-select: none;

                        span {
                            margin-right: 0.1rem;
                        }

                        img {
                            width: 0.2rem;
                            height: 0.2rem;
                            margin-right: 0.05rem;
                        }
                    }
                }
            }

            .item-content-desc {
                font-size: 0.2rem;
                color: #000;
                line-height: 0.3rem;
            }
        }
    }
}</style>